//
//  WBNavigationController.swift
//  陌路微博
//
//  Created by 张继强 on 16/12/2.
//  Copyright © 2016年 张继强. All rights reserved.
//

import UIKit

class WBNavigationController: UINavigationController ,UINavigationControllerDelegate{
    
    override func viewDidLoad() {
        super.viewDidLoad()
//        //隐藏默认的navgationBar
//        self.navigationBar.isHidden = true
        self.delegate = self
    }
    
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    @objc fileprivate func popToController(){
        self.popViewController(animated: true)
    }
//    override func popToRootViewController(animated: Bool) -> [UIViewController]? {
//        for child:UIView in (self.viewControllers.first?.tabBarController?.tabBar.subviews)!{
//            if child.isKind(of: UIControl.self){
//                if child.isKind(of: FZHTabBar.self){
//                    
//                }else{
//                   child.removeFromSuperview()
//                }
//            }
//        }
//        return super.popToRootViewController(animated: animated)
//    }
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if self.childViewControllers.count>0{
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
        for item:UIView in (self.tabBarController?.tabBar.subviews)! {
            if item.isKind(of: NSClassFromString("UITabBarButton")!){
                item.removeFromSuperview()
            }
        }
    }
}

